package com.pan.kang.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pan.kang.entity.TableSchemaEntity;
import com.pan.kang.mapper.TableSchemeMapper;
import com.pan.kang.model.TableSchema;
import com.pan.kang.service.TableSchemaService;
import com.pan.kang.transfer.TableSchemaTransfer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class TableSchemaServiceImpl extends ServiceImpl<TableSchemeMapper, TableSchemaEntity>
        implements TableSchemaService {

    @Autowired
    private TableSchemaTransfer tableSchemaTransfer;

    @Override
    public void saveTableSchemaModel(TableSchema model) {
        log.info("TableScheme 模型数据：{}", model);
        List<TableSchemaEntity> entityList = tableSchemaTransfer.modelToEntity(model);
        log.info("TableScheme 实体数据：{}", entityList);
        saveBatch(entityList);
    }
}
